import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name:'fault',
    component: () => import('../view/fault.vue'),
    children: [
      {
        path: '/failure',
        name:'failure',
        component: function () {
          return import( '../view/failure.vue' )
        }
      },
      {
        path: '/runState',
        name:'runState',
        component: () => import('../view/runState.vue'),
      }
    ]
  },
  {
    path: '/',
    name:'state',
    component: () => import('../view/state.vue'),
    children: [
      {
        path: '/full',
        name:'full',
        component: function () {
          return import( '../view/full.vue' )
        }
      },
      {
        path: '/monitoring',
        name:'monitoring',
        component: () => import('../view/monitoring.vue'),
      },
      {
        path: '/data',
        name:'data',
        component: () => import('../view/data.vue'),
      }
    ]
  }
]


const router = new VueRouter({
  routes,
  mode: 'history',
  base:'/jrzlss'
})

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(() => {
  });
};

export default router;